package cn.cleanarch.infra.idp.pms.constants;

/**
 * 设计文件相关常量定义
 */
public final class DesignFileConstants {

    private DesignFileConstants() {
        // 防止实例化
    }

    // 状态常量
    public static final String STATUS_NORMAL = "NORMAL";
    public static final String STATUS_DELETED = "DELETED";
    public static final String STATUS_ARCHIVED = "ARCHIVED";
    
    public static final String USED_STATUS_UNUSED = "UNUSED";
    public static final String USED_STATUS_USED = "USED";
    public static final String USED_STATUS_DEPRECATED = "DEPRECATED";
    
    public static final String SECURITY_STATUS_UNSCANNED = "UNSCANNED";
    public static final String SECURITY_STATUS_SAFE = "SAFE";
    public static final String SECURITY_STATUS_UNSAFE = "UNSAFE";
    public static final String SECURITY_STATUS_SUSPICIOUS = "SUSPICIOUS";
    
    public static final String STORAGE_STATUS_UPLOADING = "UPLOADING";
    public static final String STORAGE_STATUS_STORED = "STORED";
    public static final String STORAGE_STATUS_FAILED = "FAILED";
    public static final String STORAGE_STATUS_DELETED = "DELETED";

    // 默认版本
    public static final String DEFAULT_VERSION = "1.0";
    
    // 默认描述
    public static final String DEFAULT_DESCRIPTION = "上传的设计文件";

    // 预览相关
    public static final String PREVIEW_TYPE_HTML = "html";
    public static final String PREVIEW_TYPE_IMAGE = "image";
    public static final String PREVIEW_TYPE_DOCUMENT = "document";
    public static final String PREVIEW_TYPE_DOWNLOAD = "download";

    // 文件上传限制
    public static final long MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
    public static final String[] ALLOWED_EXTENSIONS = {
        ".html", ".htm", ".zip", ".axure", ".fig", ".sketch", ".xd",
        ".jpg", ".jpeg", ".png", ".gif", ".svg", ".bmp", ".webp"
    };

    // 解压缓存相关
    public static final long CACHE_MAX_AGE = 24 * 60 * 60 * 1000; // 24小时
    public static final int EXTRACT_LOCK_TIMEOUT = 5; // 5秒
    public static final int BUFFER_SIZE = 4096;

    // 模拟上传
    public static final long UPLOAD_SIMULATION_DELAY = 100; // 100ms
    public static final double UPLOAD_SUCCESS_RATE = 0.9; // 90%

    /**
     * 获取状态显示名称
     */
    public static String getStatusName(String status) {
        switch (status) {
            case STATUS_NORMAL: return "正常";
            case STATUS_DELETED: return "已删除";
            case STATUS_ARCHIVED: return "已归档";
            default: return status;
        }
    }

    /**
     * 获取使用状态显示名称
     */
    public static String getUsedStatusName(String usedStatus) {
        switch (usedStatus) {
            case USED_STATUS_UNUSED: return "未使用";
            case USED_STATUS_USED: return "已使用";
            case USED_STATUS_DEPRECATED: return "已弃用";
            default: return usedStatus;
        }
    }

    /**
     * 获取安全状态显示名称
     */
    public static String getSecurityStatusName(String securityStatus) {
        switch (securityStatus) {
            case SECURITY_STATUS_UNSCANNED: return "未扫描";
            case SECURITY_STATUS_SAFE: return "安全";
            case SECURITY_STATUS_UNSAFE: return "不安全";
            case SECURITY_STATUS_SUSPICIOUS: return "可疑";
            default: return securityStatus;
        }
    }

    /**
     * 获取存储状态显示名称
     */
    public static String getStorageStatusName(String storageStatus) {
        switch (storageStatus) {
            case STORAGE_STATUS_UPLOADING: return "上传中";
            case STORAGE_STATUS_STORED: return "已存储";
            case STORAGE_STATUS_FAILED: return "存储失败";
            case STORAGE_STATUS_DELETED: return "已删除";
            default: return storageStatus;
        }
    }
}